import java.util.Scanner;

public class Test3 {
    //蓝桥杯真题，2023真题-演练金属
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        while (scanner.hasNext()) {
            int n = scanner.nextInt();
            int[][] arr = new int[n][2];
            for (int i = 0; i < n; i++) {
                for (int j = 0; j < 2; j++) {
                    arr[i][j] = scanner.nextInt();
                }
            }
            int y = Integer.MAX_VALUE;
            for (int i = 0; i < n; i++) {
                y = Math.min(y,arr[i][0]/arr[i][1]);
            }
            int x = y;
            while (x > 0) {
                boolean bool = false;
                for (int i = 0; i < n; i++) {
                    if((arr[i][0] -(x*arr[i][1]))>=x) {
                        bool = true;
                        break;
                    }
                }
                if(bool) {
                    x++;
                    break;
                }else x--;
            }
            System.out.println(x+" "+y);
        }
    }
}
